﻿Public Class GecikmeCezasiHesabiIsveren2008 : Inherits GecikmeCezasiHesabiIsveren

	Sub New()
		MyBase.New()
		Yil = 2008
	End Sub

End Class

Public Class GecikmeCezasiHesabiIsveren2009 : Inherits GecikmeCezasiHesabiIsveren

	Sub New()
		MyBase.New()
		Yil = 2009
	End Sub

End Class

Public Class GecikmeCezasiHesabiIsveren2011 : Inherits GecikmeCezasiHesabiIsveren

	Sub New()
		MyBase.New()
		Yil = 2011
	End Sub

End Class

Public Class GecikmeCezasiHesabiIsveren : Inherits ProcessReport

	Public Yil As Integer
	Dim Rsg, Rst As Recordset

	Public Overrides Sub GenericEvent(ByVal e As ProcessEventArgs)
		Select Case e.EventType
			Case EventType.Initialize
				Start("Af gecikme cezası raporu", "İşveren bilgisini girin.")
				AddSigortali()
			Case EventType.Shown
				If Not Arguments.ContainsKey("isyerino") Then Exit Sub
				SetValues("Sigortali", Arguments("sno"))
				Report.Focus()
			Case EventType.ValidateForm
				Rsg = Hukuk.Af.GenelIsverenOku(Local, Yil, Input("Sigortali"))
				If Check("Sigortali", Rsg.EOF, "Bu sigortalı aftan yararlandırılmadı.") Then Exit Sub
				e.Result = True
			Case EventType.CoverPage
				Dim Rs As Recordset = Sigortali.SnoAra(Local, Input("Sigortali"))
				Report.PrintHeader(Yil & " AFFI GECİKME CEZASI RAPORU")
				Report.SetColumns("Kimlik no.;Sigorta no.;Adı soyadı;Ödeme tar.", "1;1;3;1", "c;c;l;c", "-")
				Report.Print(Rs("kimlik"), Rs("sno"), RTrim(Rs("adi")) & " " & RTrim(Rs("soyadi")), Today.Date)
				Report.SkipLine()
				Rst = Hukuk.Af.TaksitIsverenOku(Local, Yil, Input("Sigortali"))
			Case EventType.PageHeader
				Report.SetColumns("Bordro Tar.;Bordro;Anapara;Ceza;İnd.Ceza;Toplam;Öde.Tar.;Oran;Cezalı", "2;1;2;2;2;2;2;1;2", "d;c;m;m;m;m;d;c;m", "--")
			Case EventType.ReportDetail
				Rs = Rst
				Dim Toplam As Decimal = 0
				For Each Row In Rs
					If Rs("tur") = "T" Then
						Dim CezaOran = Prim.FaizOraniHesabi(Rs("odetar"), Today.Date)
						Dim CezaTutar = (Rs("anapara") + Rs("ceza")) * (100 + CezaOran) / 100
						Toplam += CezaTutar
						Report.Print(Rs("bordrotar"), Rs("bordro"), Rs("anapara"), Rs("ceza") / 0.3, Rs("ceza"), Rs("anapara") + Rs("ceza"), Rs("odetar"), Format(CezaOran, "###0.0"), CezaTutar)
					End If
				Next
				If Not Rs.Count = 0 Then Report.PrintTotal("<cs=8>", Toplam)
		End Select
	End Sub

End Class
